import { getWarehouseListApi } from '@/api/system/sys/warehouse'

// 获取仓库列表hooks
export default function useGetWarehouseList() {
  const warehouseOptions = ref([])
  const warehouseLoading = ref(false)

  const fetchGetWarehouseList = async () => {
    warehouseLoading.value = true
    const res = await getWarehouseListApi()
    if (res.code === '0000') {
      warehouseOptions.value = res.data
    }
    warehouseLoading.value = false
  }

  fetchGetWarehouseList()

  return {
    fetchGetWarehouseList,
    warehouseOptions,
    warehouseLoading
  }
}
